home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / BARMDI.PAK / GLOBALS.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  7KB  |  195 lines

  1. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  2. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  3. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  4. // PARTICULAR PURPOSE.
  5. //
  6. // Copyright (C) 1993-1995  Microsoft Corporation.  All Rights Reserved.
  7. //
  8. // PURPOSE:
  9. //    Contains declarations for all globally scoped names in the program.
  10. //
  11.  
  12. //-------------------------------------------------------------------------
  13. // Product identifier string defines
  14.  
  15. //  **TODO** Change these strings to the name of your application.
  16.  
  17. #define APPNAME       BarMDI
  18. #define ICONFILE      BarMDI.ICO
  19. #define SZAPPNAME     "BarMDI"
  20. #define SZCHILDNAME   "MdiChild"
  21. #define SZDESCRIPTION "BarMDI Example Application"
  22. #define SZABOUT       "About BarMDI"
  23. #define SZVERSION     "Version 4.0"
  24.  
  25.  
  26. //-------------------------------------------------------------------------
  27. // Functions for handling main window messages.  The message-dispatching
  28. // mechanism expects all message-handling functions to have the following
  29. // prototype:
  30. //
  31. //     LRESULT FunctionName(HWND, UINT, WPARAM, LPARAM);
  32.  
  33. // **TODO**  Add message-handling function prototypes here.  Be sure to
  34. //           add the function names to the main window message table in
  35. //           barmdi.c.
  36.  
  37. LRESULT MsgCommand   (HWND, UINT, WPARAM, LPARAM);
  38. LRESULT MsgDestroy   (HWND, UINT, WPARAM, LPARAM);
  39. LRESULT MsgMCCommand (HWND, UINT, WPARAM, LPARAM);
  40. LRESULT MsgCreate    (HWND, UINT, WPARAM, LPARAM);
  41. LRESULT MsgMCDestroy (HWND, UINT, WPARAM, LPARAM);
  42. LRESULT MsgInitMenu  (HWND, UINT, WPARAM, LPARAM);
  43. LRESULT MsgMenuSelect(HWND, UINT, WPARAM, LPARAM);
  44. LRESULT MsgNotify    (HWND, UINT, WPARAM, LPARAM);
  45. LRESULT MsgTimer     (HWND, UINT, WPARAM, LPARAM);
  46. LRESULT MsgSize      (HWND, UINT, WPARAM, LPARAM);
  47.  
  48.  
  49. //-------------------------------------------------------------------------
  50. // Functions for handling main window commands--ie. functions for
  51. // processing WM_COMMAND messages based on the wParam value.
  52. // The message-dispatching mechanism expects all command-handling
  53. // functions to have the following prototype:
  54. //
  55. //     LRESULT FunctionName(HWND, WORD, WORD, HWND);
  56.  
  57. // **TODO**  Add message-handling function prototypes here.  Be sure to
  58. //           add the function names to the main window command table in
  59. //           barmdi.c.
  60.  
  61. LRESULT CmdExit(HWND, WORD, WORD, HWND);
  62. LRESULT CmdAbout(HWND, WORD, WORD, HWND);
  63.  
  64. //
  65. // File Commands
  66. //
  67.  
  68. LRESULT CmdFileNew(HWND, WORD, WORD, HWND);
  69. LRESULT CmdFileOpen(HWND, WORD, WORD, HWND);
  70. LRESULT CmdFileSave(HWND, WORD, WORD, HWND);
  71. LRESULT CmdFileSaveAs(HWND, WORD, WORD, HWND);
  72. LRESULT CmdFilePrint(HWND, WORD, WORD, HWND);
  73. LRESULT CmdFilePrintSU(HWND, WORD, WORD, HWND);
  74. LRESULT CmdFileClose(HWND, WORD, WORD, HWND);
  75.  
  76. //
  77. // Window Commands
  78. //
  79.  
  80. LRESULT CmdWindowTile(HWND, WORD, WORD, HWND);
  81. LRESULT CmdWindowCascade(HWND, WORD, WORD, HWND);
  82. LRESULT CmdWindowIcons(HWND, WORD, WORD, HWND);
  83. LRESULT CmdWindowCloseAll(HWND, WORD, WORD, HWND);
  84.  
  85.  
  86.  
  87. //-------------------------------------------------------------------------
  88. // Global function prototypes.
  89.  
  90. // **TODO**  Add global function prototypes here.
  91.  
  92. BOOL InitApplication(HINSTANCE, int);
  93. BOOL CenterWindow(HWND, HWND);
  94. BOOL InitMDIChild(HINSTANCE);
  95.  
  96.  
  97.     // Callback functions.  These are called by Windows.
  98.  
  99. // **TODO**  Add new callback function prototypes here.
  100.  
  101. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  102. LRESULT CALLBACK MDIChildWndProc(HWND, UINT, WPARAM, LPARAM);
  103.  
  104.  
  105. //-------------------------------------------------------------------------
  106. // Global variable declarations.
  107.  
  108. extern HINSTANCE hInst;          // The current instance handle
  109. extern char      szAppName[];    // The name of this application
  110. extern char      szTitle[];      // The title bar text
  111.  
  112. // **TODO**  For NON-MDI applications, uncomment line 1 below and comment
  113. //           line 2.  For MDI applications, uncomment line 2 below, comment
  114. //           line 1, and then define hwndMDIClient as a global variable in
  115. //           INIT.C
  116. //#define hwndMDIClient NULL     /* (1) Stub for NON-MDI applications. */
  117. extern HWND hwndMDIClient;       /* (2) For MDI applications.          */
  118.  
  119. // **BLANDMDI** MDI Frame and Client windows must be accessable to many modules.
  120. extern HWND hwndFrame;           // The MDI Frame window
  121. extern UINT cUntitled;
  122. extern UINT cOpen;
  123.  
  124.  
  125.  
  126.  
  127. //-------------------------------------------------------------------------
  128. // Message and command dispatch infrastructure.  The following type
  129. // definitions and functions are used by the message and command dispatching
  130. // mechanism and do not need to be changed.
  131.  
  132.     // Function pointer prototype for message handling functions.
  133. typedef LRESULT (*PFNMSG)(HWND,UINT,WPARAM,LPARAM);
  134.  
  135.     // Function pointer prototype for command handling functions.
  136. typedef LRESULT (*PFNCMD)(HWND,WORD,WORD,HWND);
  137.  
  138.     // Enumerated type used to determine which default window procedure
  139.     // should be called by the message- and command-dispatching mechanism
  140.     // if a message or command is not handled explicitly.
  141. typedef enum
  142. {
  143.    edwpNone,            // Do not call any default procedure.
  144.    edwpWindow,          // Call DefWindowProc.
  145.    edwpDialog,          // Call DefDlgProc (This should be used only for
  146.                         // custom dialogs - standard dialog use edwpNone).
  147.    edwpMDIChild,        // Call DefMDIChildProc.
  148.    edwpMDIFrame         // Call DefFrameProc.
  149. } EDWP;                // Enumeration for Default Window Procedures
  150.  
  151.     // This structure maps messages to message handling functions.
  152. typedef struct _MSD
  153. {
  154.     UINT   uMessage;
  155.     PFNMSG pfnmsg;
  156. } MSD;                 // MeSsage Dispatch structure
  157.  
  158.     // This structure contains all of the information that a window
  159.     // procedure passes to DispMessage in order to define the message
  160.     // dispatching behavior for the window.
  161. typedef struct _MSDI
  162. {
  163.     int  cmsd;          // Number of message dispatch structs in rgmsd
  164.     MSD *rgmsd;         // Table of message dispatch structures
  165.     EDWP edwp;          // Type of default window handler needed.
  166. } MSDI, FAR *LPMSDI;    // MeSsage Dipatch Information
  167.  
  168.     // This structure maps command IDs to command handling functions.
  169. typedef struct _CMD
  170. {
  171.     WORD   wCommand;
  172.     PFNCMD pfncmd;
  173. } CMD;                  // CoMmand Dispatch structure
  174.  
  175.     // This structure contains all of the information that a command
  176.     // message procedure passes to DispCommand in order to define the
  177.     // command dispatching behavior for the window.
  178. typedef struct _CMDI
  179. {
  180.     int  ccmd;          // Number of command dispatch structs in rgcmd
  181.     CMD *rgcmd;         // Table of command dispatch structures
  182.     EDWP edwp;          // Type of default window handler needed.
  183. } CMDI, FAR *LPCMDI;    // CoMmand Dispatch Information
  184.  
  185.     // Message and command dispatching functions.  They look up messages
  186.     // and commands in the dispatch tables and call the appropriate handler
  187.     // function.
  188. LRESULT DispMessage(LPMSDI, HWND, UINT, WPARAM, LPARAM);
  189. LRESULT DispCommand(LPCMDI, HWND, WPARAM, LPARAM);
  190.  
  191.     // Message dispatch information for the main window
  192. extern MSDI msdiMain;
  193.     // Command dispatch information for the main window
  194. extern CMDI cmdiMain;
  195.